
/* App Module */

var app = angular.module('app', [
  'ngRoute',
  'ngCookies',
  'ngAnimate',
  'ui.tree',
  'ui.bootstrap',
  'ui.validate',
  'z.ui.bootstrap',
  'z.ui.bootstrap.viewstack',
  'Encrypt'
]);

//定义全局变量-下载地址
app.constant('downloadUrl', '');    //方法3定义全局变量 
//定义全局变量-请求表单
app.provider('tokenService', function () {
    var data = {token:0};
    var f = function (token) {
        if (token != 0)
        {
            data.token= token;
        }
        return data;
    };
    this.$get = function () {
        return f;
    };
});

//禁止模板缓存  
app.run(function($rootScope, $templateCache) {  
    $rootScope.$on('$routeChangeStart', function(event, next, current) {  
        if (typeof(current) !== 'undefined'){  
            $templateCache.remove(current.templateUrl);  
        }  
    });  
});  

/**
 * 路由控制器
 */
app.config([ '$routeProvider','$controllerProvider', function($routeProvider,$controllerProvider) {
	$routeProvider.
	when('/salaryDetail', {
		title:'login',
		url:'	static/html/salaryRequestDetail/salaryRequestDetail.html',
		template : '<div></div>',
		controller : 'z-route-c',
	}).
	when('/forgetPassword', {
		title:'login',
		url:'static/html/home/forgetPassword.html',
		template : '<div></div>',
		controller : 'z-route-c',
	}).
	when('/login', {
		title:'login',
		url:'static/html/home/login.html',
		template : '<div></div>',
		controller : 'z-route-c',
	}).
	when('/404', {
		title:'404',
		url:'static/html/home/404.html',
		template : '<div></div>',
		controller : 'z-route-c'
	}).
	when('/500', {
		template : '<div></div>',
		controller : 'z-route-c'
	}).
	when('/:page*\/params=:params*', {
		title:'index',
		url:'static/html/home/index.html',
		template : '<div></div>',
		controller : 'z-route-c',
	}).
	when('/:page*', {
		title:'index',
		url:'static/html/home/index.html',
		template : '<div></div>',
		controller : 'z-route-c',
	}).
	otherwise({ // 首页
		redirectTo : '/index'
	});
	
//	app.controllerProvider = $controllerProvider;
//	app.controllerProvider.register('')
} ])



app.config(['$httpProvider', function ($httpProvider) {
/*	$httpProvider.defaults.xsrfCookieName = 'csrftoken';  
    $httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';  */
/*	$httpProvider.defaults.xsrfCookieName = 'csrftoken';  
    $httpProvider.defaults.xsrfHeaderName = 'X-CSRF-Token';
    $httpProvider.defaults.headers.post['My-Header']='value';*/
   /* $httpProvider.defaults.headers.common = { 'My-Header' : 'value' };*/
	//$httpProvider.defaults.headers.post['Content-Type'] = 'charset=utf-8';
    //$httpProvider.defaults.headers.post['Content-Type'] = 'application/json;charset=utf-8';
	$httpProvider.defaults.headers.post['Content-Type'] = 'application/json;charset=utf-8';
    if (!$httpProvider.defaults.headers.get) {  
        $httpProvider.defaults.headers.get = {};  
    }  
    $httpProvider.defaults.headers.common["X-Requested-With"] = 'XMLHttpRequest';  
    $httpProvider.defaults.headers.get['Cache-Control'] = 'no-cache';  
    $httpProvider.defaults.headers.get['Pragma'] = 'no-cache';  
    $httpProvider.defaults.headers.get['If-Modified-Since'] = '0';
}]);




//var app = {
//    views: {},
//    models: {},
//    viewDir: './view/'
//};

var url_temp = window.location.pathname;
app.host = window.location.host;
app.webContent = url_temp.substring(0, url_temp.indexOf("/",url_temp.indexOf("/")+1));
app.viewDir = './html/';
